home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / utils / crossword / includes / cwsolutions.i < prev    next >
Encoding:
Text File  |  1980-01-04  |  39.6 KB  |  1,886 lines

  1.  
  2.  
  3. * This file contains stuff for solving the crossword.
  4. * At last! We get to enter solutions!
  5.  
  6.  
  7. * ShowAcrossClue(a6)
  8. * a6 = ptr to main program variables
  9.  
  10. * Insert the clue text into the IntuiTexts for the
  11. * solve requester, so that when it comes up, the user knows
  12. * what the clue number is.
  13.  
  14. * Also gets pointer to clue text for the ShowQuestion()
  15. * routine.
  16.  
  17. * This one for across clues: ShowDownClue() below does
  18. * the same for down clues
  19.  
  20.  
  21. * d0-d2/d7/a0-a1 corrupt
  22.  
  23.  
  24. ShowAcrossClue    bsr    TXAcross
  25.  
  26.         lea    SolveT3(pc),a0    ;ptr to 1st IText
  27.         lea    ITT_Alt1(pc),a1    ;ptr to Across text
  28.         move.l    a1,12(a0)    ;pop in text ptr
  29.         move.w    #64,4(a0)    ;and position
  30.         move.l    16(a0),a0    ;point to next IText
  31.         move.l    a1,12(a0)    ;and insert text ptr here too
  32.         move.w    #63,4(a0)    ;and print position
  33.  
  34.         move.w    pick_across(a6),d0
  35.         move.l    clue_list(a6),a0
  36.         move.w    clh_AcCount(a0),d7
  37.         move.l    clh_AcList(a0),a0
  38.  
  39. SACL_1        cmp.w    (a0),d0        ;this clue?
  40.         beq.s    SACL_2        ;yes-go get pointer
  41.  
  42.         add.w    #cle_sizeof,a0    ;else get next clue
  43.         subq.w    #1,d7        ;done them all?
  44.         bne.s    SACL_1        ;no, go back
  45.  
  46.         sub.l    a0,a0        ;else there isn't one!
  47.         bra.s    SACL_3
  48.  
  49. SACL_2        move.l    cle_Text(a0),a0    ;get ptr to clue text
  50.  
  51. SACL_3        move.l    a0,solve_ptr(a6)    ;save it!
  52.  
  53.         rts
  54.  
  55.  
  56. * ShowDownClue(a6)
  57. * a6 = ptr to main program variables
  58.  
  59. * See above for description & corrupt reg list
  60.  
  61.  
  62. ShowDownClue    bsr    TXDown
  63.  
  64.         lea    SolveT3(pc),a0    ;ptr to 1st IText
  65.         lea    ITT_Alt2(pc),a1    ;ptr to Across text
  66.         move.l    a1,12(a0)    ;pop in text ptr
  67.         move.w    #72,4(a0)    ;and print position
  68.         move.l    16(a0),a0    ;point to next IText
  69.         move.l    a1,12(a0)    ;and insert text ptr here too
  70.         move.w    #71,4(a0)    ;and print position
  71.  
  72.         move.w    pick_down(a6),d0
  73.         move.l    clue_list(a6),a0
  74.         move.w    clh_DnCount(a0),d7
  75.         move.l    clh_DnList(a0),a0
  76.  
  77. SDCL_1        cmp.w    (a0),d0        ;this clue?
  78.         beq.s    SDCL_2        ;yes-go get pointer
  79.  
  80.         add.w    #cle_sizeof,a0    ;else get next clue
  81.         subq.w    #1,d7        ;done them all?
  82.         bne.s    SDCL_1        ;no, go back
  83.  
  84.         sub.l    a0,a0        ;else there isn't one!
  85.         bra.s    SDCL_3
  86.  
  87. SDCL_2        move.l    cle_Text(a0),a0    ;get ptr to clue text
  88.  
  89. SDCL_3        move.l    a0,solve_ptr(a6)    ;save it!
  90.  
  91.         rts
  92.  
  93.  
  94. * ShowQuestion(a6)
  95. * a6 = ptr to main program variables
  96.  
  97. * This routine pops the actual clue question into the
  98. * solve requester. It also formats the text!
  99.  
  100. * d0-d4/d7/a0-a2 corrupt
  101.  
  102.  
  103. ShowQuestion    move.l    solve_ptr(a6),d0    ;any clue text?
  104. ;        beq    SQ_Done        ;no
  105.         beq    SQ_NoText
  106.  
  107.         move.l    d0,a0        ;else this is source text ptr
  108.  
  109.         lea    SolveBuf(pc),a1    ;ptr to dest buffer
  110.  
  111. SQ_L1        moveq    #0,d0        ;no of chars copied
  112.  
  113. SQ_L2        tst.b    (a0)        ;get char-EOS met?
  114.         beq.s    SQ_B1        ;skip if so
  115.  
  116.         move.b    (a0)+,(a1)+    ;copy chars
  117.         addq.w    #1,d0        ;no. of chars processed
  118.         cmp.w    #MAXCTLEN,d0    ;done enough for 1 line?
  119.         bcs.s    SQ_L2        ;loop back if so
  120.  
  121.         subq.l    #1,a1        ;point to last char copied
  122.  
  123.         cmp.b    #" ",(a1)    ;last char a " "?
  124.         bne.s    SQ_B2        ;skip if not
  125.  
  126. SQ_L3        subq.l    #1,a1        ;skip back until a
  127.         cmp.b    #" ",(a1)    ;non-space char found
  128.         beq.s    SQ_L3
  129.         addq.l    #1,a1        ;point beyond chars
  130.         clr.b    (a1)+        ;and pop in an EOS
  131.         bra.s    SQ_L1        ;and do another string
  132.  
  133. SQ_B2        moveq    #0,d4        ;special flags
  134.  
  135.         moveq    #0,d1        ;forward scan count
  136.         move.l    d1,d2        ;backward scan count
  137.  
  138. SQ_L4        subq.w    #1,d2        ;point backwards
  139.         move.b    0(a0,d2.w),d3    ;get prev char
  140.         cmp.b    #" ",d3        ;prev char a space?
  141.         bne.s    SQ_L4        ;back if not
  142.  
  143. SQ_L4a        move.b    0(a0,d1.w),d3    ;get next char
  144.         beq.s    SQ_B3        ;Exit if EOS
  145.         cmp.b    #" ",d3        ;and also
  146.         beq.s    SQ_B3        ;exit if space
  147.         addq.w    #1,d1        ;else next char forward
  148.         bra.s    SQ_L4a        ;back for more
  149.  
  150. SQ_B3        move.w    d2,d3
  151.         neg.w    d3        ;no of back chars
  152.  
  153.         cmp.w    #4,d1        ;more than 4 forward chars?
  154.         bls.s    SQ_B3a        ;don't hyphenate if not
  155.  
  156.         cmp.w    #4,d3        ;more than 4 back chars?
  157.         bhi.s    SQ_B4        ;hyphenate if so
  158.  
  159. SQ_B3a        clr.b    1(a1,d2.w)
  160.         addq.l    #1,a1        ;point to proper insert spot
  161.         neg.w    d2
  162.         move.w    d2,d0        ;proper char count
  163.         bra.s    SQ_L2        ;and back for next string
  164.  
  165. SQ_B4        move.b    (a1),d3        ;get char to be scratched
  166.         move.b    #"-",(a1)+    ;here hyphenate
  167.         clr.b    (a1)+        ;and pop in EOS
  168.         move.b    d3,(a1)+        ;replace scratched char
  169.  
  170.         moveq    #1,d0        ;new init char count
  171.         bra.s    SQ_L2        ;and continue scan
  172.  
  173. SQ_B1        clr.b    (a1)+        ;pop in final EOS
  174.  
  175.         move.b    #-1,(a1)+    ;signal end of strings
  176.         clr.b    (a1)+        ;and another EOS
  177.  
  178.  
  179. * Now that we have a collection of correctly formatted text strings
  180. * located in SolveBuf, pop pointers to them into the requester ITexts.
  181.  
  182.  
  183.         lea    SolveBuf(pc),a0
  184.  
  185.         lea    SolveT5(pc),a1
  186.  
  187. SQ_L5        cmp.b    #-1,(a0)        ;hit end of clue strings?
  188.         beq.s    SQ_B5        ;skip if so
  189.  
  190.         move.l    a1,-(sp)        ;save IText ptr
  191.         bsr    StrLen        ;how long is the string?
  192.         move.l    (sp)+,a1        ;recover IText ptr
  193.  
  194.         add.w    d0,d0        ;length * 8
  195.         add.w    d0,d0
  196.         add.w    d0,d0
  197.  
  198.         neg.w    d0
  199.         add.w    #270,d0
  200.         lsr.w    #1,d0        ;xpos = (270-len*8)/2
  201.  
  202.         move.w    d0,d1        ;d0 = pos of 2nd text
  203.         addq.w    #1,d1        ;pos of 1st text
  204.  
  205.         move.l    a0,12(a1)    ;pop in text ptr
  206.         move.w    d1,4(a1)        ;and its position
  207.         move.l    16(a1),a2    ;get ptr to next IText
  208.         move.l    a0,12(a2)    ;and pop in text ptr
  209.         move.w    d0,4(a2)        ;and position
  210.  
  211.         move.l    16(a2),d0    ;get next IText ptr
  212.         bne.s    SQ_B6        ;skip if it exists
  213.         pea    20(a2)        ;ptr to next next IText!
  214.         move.l    (sp)+,d0        ;how to do it without a3...
  215.  
  216. SQ_B6        move.l    d0,16(a2)    ;and set it up
  217.  
  218.         move.l    d0,a1        ;now point to it properly...
  219.  
  220. SQ_L6        tst.b    (a0)+        ;skip to EOS
  221.         bne.s    SQ_L6        ;and beyond...
  222.  
  223.         bra.s    SQ_L5        ;back for more!!!
  224.  
  225. SQ_B5        clr.l    16(a2)        ;ensure last IText...
  226.  
  227. SQ_Done        rts
  228.  
  229.  
  230. * Note: the following code MUST clear TWO IText structures of string
  231. * pointers, then clear the it_NextText pointer of the SECOND IText
  232. * structure to maintain compatibility with the above routine. This is
  233. * added code to kill off the minor niggle of leftover text when a new
  234. * rendition of the GetSolution requester occurs with a nonexistent
  235. * clue question.
  236.  
  237.  
  238. SQ_NoText    lea    SolveT5(pc),a0    ;ptr to 1st IText
  239.         clr.l    12(a0)        ;clear actual text ptr
  240.         move.l    16(a0),a0    ;point to next IText
  241.         clr.l    12(a0)        ;clear actual text ptr
  242.         clr.l    16(a0)        ;and next IText ptr
  243.  
  244.         rts
  245.  
  246.  
  247. * ClearAcross(a6)
  248. * a6 = ptr to main program variables
  249.  
  250. * Attempt to erase a solution from an Across clue.
  251. * Perform an intelligent erase, i.e., erase only those
  252. * characters unique to the chosen solution. Any chars
  253. * forming part of an intersecting solution are left
  254. * unerased.
  255.  
  256.  
  257. * d0-d3/a0-a1 corrupt.
  258.  
  259.  
  260. ClearAcross    btst    #6,applic_flag1(a6)    ;Type 1 crossword?
  261.         bne    CAC_B5            ;skip if not
  262.  
  263.  
  264. * Here handle Type 1 crossword.
  265.  
  266.  
  267.         move.w    pick_across(a6),d0    ;Across clue?
  268.         beq.s    CAC_B4            ;no, so skip
  269.  
  270.         move.w    pick_Ach(a6),d0        ;get start position
  271.         move.w    pick_Acv(a6),d1
  272.  
  273. CAC_L1        cmp.w    grid_across(a6),d0    ;hit RHS?
  274.         bhi.s    CAC_B4            ;exit if so
  275.  
  276.         move.w    d1,d2            ;create pointer
  277.         subq.w    #1,d2            ;to array
  278.         mulu    grid_across(a6),d2    ;element
  279.         add.l    d2,d2
  280.         move.l    d2,a0
  281.         move.w    d0,d2
  282.         subq.w    #1,d2
  283.         add.w    d2,d2
  284.         add.w    d2,a0
  285.         add.l    grid_array(a6),a0        ;this is pointer
  286.  
  287.         move.w    (a0),d2        ;get square data
  288.         tst.b    d2        ;black square?
  289.         beq.s    CAC_B4        ;skip-done erasing!
  290.  
  291.         move.w    d1,d3        ;previous down square
  292.         subq.w    #1,d3        ;does it exist?
  293.         beq.s    CAC_B1        ;no, check next
  294.  
  295.         move.l    a0,a1            ;copy ptr
  296.         move.w    grid_across(a6),d3
  297.         add.w    d3,d3
  298.         sub.w    d3,a1            ;point to prev
  299.  
  300.         move.w    (a1),d3        ;get square data
  301.         tst.b    d3        ;black square?
  302.         beq.s    CAC_B1        ;yes, check next
  303.         cmp.b    #" ",d3        ;white square?
  304.         bne.s    CAC_B3        ;no, DON'T erase
  305.  
  306. CAC_B1        move.w    d1,d3        ;next down square
  307.         addq.w    #1,d3        ;does it exist?
  308.         cmp.w    grid_down(a6),d3
  309.         bhi.s    CAC_B2        ;no, go and erase
  310.  
  311.         move.l    a0,a1            ;copy ptr
  312.         move.w    grid_across(a6),d3
  313.         add.w    d3,d3
  314.         add.w    d3,a1            ;point to next
  315.  
  316.         move.w    (a1),d3        ;get square data
  317.         tst.b    d3        ;black square?
  318.         beq.s    CAC_B2        ;yes, so erase
  319.         cmp.b    #" ",d3        ;white square?
  320.         bne.s    CAC_B3        ;no, DON'T erase
  321.  
  322. CAC_B2        move.b    #" ",d2        ;erase solution char
  323.         move.w    d2,(a0)        ;from this square
  324.  
  325.         movem.w    d0-d1,-(sp)    ;save position data
  326.         bsr    SetSquare    ;change graphic on grid
  327.         movem.w    (sp)+,d0-d1    ;recover position data
  328.  
  329. CAC_B3        addq.w    #1,d0        ;next across square
  330.         bra.s    CAC_L1
  331.  
  332.  
  333. * Here, we're done.
  334.  
  335.  
  336. CAC_B4        move.l    clue_AcEntry(a6),a0
  337.         clr.b    cle_Solved(a0)
  338.  
  339.         rts
  340.  
  341.  
  342. * Here, erasing from a Type 2 crossword.
  343.  
  344.  
  345. CAC_B5        move.w    pick_across(a6),d0    ;Across clue?
  346.         beq    CAC_B9            ;no, so skip
  347.  
  348.         move.w    pick_Ach(a6),d0        ;get start position
  349.         move.w    pick_Acv(a6),d1
  350.  
  351. CAC_L2        cmp.w    grid_across(a6),d0    ;hit RHS?
  352.         bhi.s    CAC_B9            ;exit if so
  353.  
  354.         move.w    d1,d2            ;create pointer
  355.         subq.w    #1,d2            ;to array
  356.         mulu    grid_across(a6),d2    ;element
  357.         add.l    d2,d2
  358.         move.l    d2,a0
  359.         move.w    d0,d2
  360.         subq.w    #1,d2
  361.         add.w    d2,d2
  362.         add.w    d2,a0
  363.         add.l    grid_array(a6),a0        ;this is pointer
  364.  
  365.         move.w    (a0),d2        ;get square data
  366.         tst.b    d2        ;black square?
  367.         beq.s    CAC_B9        ;skip-done erasing!
  368.  
  369.         move.w    d1,d3        ;previous down square
  370.         subq.w    #1,d3        ;does it exist?
  371.         beq.s    CAC_B6        ;no, check next
  372.  
  373.         move.l    a0,a1            ;copy ptr
  374.         move.w    grid_across(a6),d3
  375.         add.w    d3,d3
  376.         sub.w    d3,a1            ;point to prev
  377.  
  378.         move.w    (a1),d3        ;get square data
  379.         btst    #8,d3        ;prev square vert barred?
  380.         bne.s    CAC_B6        ;yes, check next
  381.  
  382.         cmp.b    #" ",d3        ;white square?
  383.         bne.s    CAC_B8        ;no, DON'T erase
  384.  
  385. CAC_B6        btst    #8,d2        ;this square vert barred?
  386.         bne.s    CAC_B7        ;yes, go and erase
  387.  
  388.         move.w    d1,d3        ;next down square
  389.         addq.w    #1,d3        ;does it exist?
  390.         cmp.w    grid_down(a6),d3
  391.         bhi.s    CAC_B7        ;no, go and erase
  392.  
  393.         move.l    a0,a1            ;copy ptr
  394.         move.w    grid_across(a6),d3
  395.         add.w    d3,d3
  396.         add.w    d3,a1            ;point to next
  397.  
  398.         move.w    (a1),d3        ;get square data
  399.         cmp.b    #" ",d3        ;white square?
  400.         bne.s    CAC_B8        ;no, DON'T erase
  401.  
  402. CAC_B7        move.b    #" ",d2        ;erase solution char
  403.         move.w    d2,(a0)        ;from this square
  404.  
  405.         movem.w    d0-d1,-(sp)    ;save position data
  406.         bsr    SetSquare    ;change graphic on grid
  407.         movem.w    (sp)+,d0-d1    ;recover position data
  408.  
  409. CAC_B8        addq.w    #1,d0        ;next across square
  410.         bra.s    CAC_L2
  411.  
  412.  
  413. * Here, we're done.
  414.  
  415.  
  416. CAC_B9        move.l    clue_AcEntry(a6),a0
  417.         clr.b    cle_Solved(a0)
  418.         rts
  419.  
  420.  
  421.  
  422. * ClearDown(a6)
  423. * a6 = ptr to main program variables
  424.  
  425. * Attempt to erase a solution from a Down clue.
  426. * Perform an intelligent erase, i.e., erase only those
  427. * characters unique to the chosen solution. Any chars
  428. * forming part of an intersecting solution are left
  429. * unerased.
  430.  
  431.  
  432. * d0-d3/a0-a1 corrupt.
  433.  
  434.  
  435. ClearDown    btst    #6,applic_flag1(a6)    ;Type 1 crossword?
  436.         bne    CDN_B5            ;skip if not
  437.  
  438.  
  439. * Here handle Type 1 crossword.
  440.  
  441.  
  442.         move.w    pick_down(a6),d0        ;Down clue?
  443.         beq.s    CDN_B4            ;no, so skip
  444.  
  445.         move.w    pick_Dnh(a6),d0        ;get start position
  446.         move.w    pick_Dnv(a6),d1
  447.  
  448. CDN_L1        cmp.w    grid_down(a6),d1        ;hit bottom?
  449.         bhi.s    CDN_B4            ;exit if so
  450.  
  451.         move.w    d1,d2            ;create pointer
  452.         subq.w    #1,d2            ;to array
  453.         mulu    grid_across(a6),d2    ;element
  454.         add.l    d2,d2
  455.         move.l    d2,a0
  456.         move.w    d0,d2
  457.         subq.w    #1,d2
  458.         add.w    d2,d2
  459.         add.w    d2,a0
  460.         add.l    grid_array(a6),a0        ;this is pointer
  461.  
  462.         move.w    (a0),d2        ;get square data
  463.         tst.b    d2        ;black square?
  464.         beq.s    CDN_B4        ;skip-done erasing!
  465.  
  466.         move.w    d0,d3        ;previous across square
  467.         subq.w    #1,d3        ;does it exist?
  468.         beq.s    CDN_B1        ;no, check next
  469.  
  470.         move.w    -2(a0),d3    ;get square data
  471.         tst.b    d3        ;black square?
  472.         beq.s    CDN_B1        ;yes, check next
  473.         cmp.b    #" ",d3        ;white square?
  474.         bne.s    CDN_B3        ;no, DON'T erase
  475.  
  476. CDN_B1        move.w    d0,d3        ;next across square
  477.         addq.w    #1,d3        ;does it exist?
  478.         cmp.w    grid_across(a6),d3
  479.         bhi.s    CDN_B2        ;no, go and erase
  480.  
  481.         move.w    2(a0),d3        ;get square data
  482.         tst.b    d3        ;black square?
  483.         beq.s    CDN_B2        ;yes, so erase
  484.         cmp.b    #" ",d3        ;white square?
  485.         bne.s    CDN_B3        ;no, DON'T erase
  486.  
  487. CDN_B2        move.b    #" ",d2        ;erase solution char
  488.         move.w    d2,(a0)        ;from this square
  489.  
  490.         movem.w    d0-d1,-(sp)    ;save position data
  491.         bsr    SetSquare    ;change graphic on grid
  492.         movem.w    (sp)+,d0-d1    ;recover position data
  493.  
  494. CDN_B3        addq.w    #1,d1        ;next down square
  495.         bra.s    CDN_L1
  496.  
  497.  
  498. * Here, we're done.
  499.  
  500.  
  501. CDN_B4        move.l    clue_DnEntry(a6),a0
  502.         clr.b    cle_Solved(a0)
  503.         rts
  504.  
  505.  
  506. * Here, erasing from a Type 2 crossword.
  507.  
  508.  
  509. CDN_B5        move.w    pick_down(a6),d0        ;Down clue?
  510.         beq.s    CDN_B9            ;no, so skip
  511.  
  512.         move.w    pick_Dnh(a6),d0        ;get start position
  513.         move.w    pick_Dnv(a6),d1
  514.  
  515. CDN_L2        cmp.w    grid_down(a6),d1        ;hit bottom?
  516.         bhi.s    CDN_B9            ;exit if so
  517.  
  518.         move.w    d1,d2            ;create pointer
  519.         subq.w    #1,d2            ;to array
  520.         mulu    grid_across(a6),d2    ;element
  521.         add.l    d2,d2
  522.         move.l    d2,a0
  523.         move.w    d0,d2
  524.         subq.w    #1,d2
  525.         add.w    d2,d2
  526.         add.w    d2,a0
  527.         add.l    grid_array(a6),a0        ;this is pointer
  528.  
  529.         move.w    (a0),d2        ;get square data
  530.         tst.b    d2        ;black square?
  531.         beq.s    CDN_B9        ;skip-done erasing!
  532.  
  533.         move.w    d0,d3        ;previous across square
  534.         subq.w    #1,d3        ;does it exist?
  535.         beq.s    CDN_B6        ;no, check next
  536.  
  537.         move.w    -2(a0),d3    ;get square data
  538.         btst    #9,d3        ;prev square horiz barred?
  539.         bne.s    CDN_B6        ;yes, check next
  540.  
  541.         cmp.b    #" ",d3        ;white square?
  542.         bne.s    CDN_B8        ;no, DON'T erase
  543.  
  544. CDN_B6        btst    #9,d2        ;this square horiz barred?
  545.         bne.s    CDN_B7        ;yes, go and erase
  546.  
  547.         move.w    d0,d3        ;next across square
  548.         addq.w    #1,d3        ;does it exist?
  549.         cmp.w    grid_across(a6),d3
  550.         bhi.s    CDN_B7        ;no, go and erase
  551.  
  552.         move.w    2(a0),d3        ;get square data
  553.         cmp.b    #" ",d3        ;white square?
  554.         bne.s    CDN_B8        ;no, DON'T erase
  555.  
  556. CDN_B7        move.b    #" ",d2        ;erase solution char
  557.         move.w    d2,(a0)        ;from this square
  558.  
  559.         movem.w    d0-d1,-(sp)    ;save position data
  560.         bsr    SetSquare    ;change graphic on grid
  561.         movem.w    (sp)+,d0-d1    ;recover position data
  562.  
  563. CDN_B8        addq.w    #1,d1        ;next down square
  564.         bra.s    CDN_L2
  565.  
  566.  
  567. * Here, we're done.
  568.  
  569.  
  570. CDN_B9        move.l    clue_DnEntry(a6),a0
  571.         clr.b    cle_Solved(a0)
  572.         rts
  573.  
  574.  
  575. * ShowPartAcross(a6)
  576. * a6 = ptr to main string variables
  577.  
  578. * Create a string containing those letters currently
  579. * in the solution, e.g.,
  580.  
  581. *        --S--T-
  582.  
  583. * to insert into the string gadget, obtained from an across
  584. * clue.
  585.  
  586. * DO NOT CALL IF REQUESTER (AND THEREFORE THE GADGET) IS ACTIVE!
  587.  
  588. * d0-d1/a0-a1 corrupt
  589.  
  590.  
  591. ShowPartAcross    tst.w    pick_across(a6)        ;got an across clue?
  592.         beq.s    SPAC_Done        ;exit if not
  593.  
  594.         move.w    pick_Ach(a6),d0        ;get start square
  595.         move.w    pick_Acv(a6),d1        ;position
  596.         move.w    d0,d2            ;copy horiz pos
  597.         subq.w    #1,d1
  598.         mulu    grid_across(a6),d1
  599.         add.l    d1,d1
  600.         add.l    grid_array(a6),d1
  601.         move.l    d1,a0
  602.         add.w    d0,a0
  603.         add.w    d0,a0
  604.         subq.l    #2,a0        ;point to 1st square
  605.  
  606.         lea    GetSolution(pc),a1
  607.         move.l    gg_SpecialInfo(a1),a1
  608.         clr.w    si_BufferPos(a1)
  609.         move.l    si_Buffer(a1),a1
  610.  
  611.         btst    #6,applic_flag1(a6)    ;which crossword type?
  612.         bne.s    SPAC_L2            ;skip if type 2
  613.  
  614. SPAC_L1        move.w    (a0)+,d0        ;get square data
  615.         tst.b    d0        ;hit black square?
  616.         beq.s    SPAC_B2        ;exit loop if so
  617.         cmp.b    #" ",d0        ;char a " "?
  618.         bne.s    SPAC_B1        ;skip if not
  619.         move.b    #"-",d0        ;else make a "-"
  620. SPAC_B1        move.b    d0,(a1)+        ;insert char into buffer
  621.         addq.w    #1,d2        ;next horiz pos
  622.  
  623.         cmp.w    grid_across(a6),d2    ;hit end of grid?
  624.         bls.s    SPAC_L1            ;back for more if not
  625.  
  626. SPAC_B2        clr.b    (a1)        ;insert EOS
  627.  
  628. SPAC_Done    rts
  629.  
  630. SPAC_L2        move.w    (a0)+,d0        ;get square data
  631.         cmp.b    #" ",d0        ;hit a " "?
  632.         bne.s    SPAC_B3        ;skip if not
  633.         move.b    #"-",d0        ;else change it into a "-"
  634. SPAC_B3        move.b    d0,(a1)+        ;pop char into buffer
  635.  
  636.         btst    #8,d0        ;hit vertical bar?
  637.         bne.s    SPAC_B2        ;exit if so
  638.  
  639.         addq.w    #1,d2            ;next horiz pos
  640.         cmp.w    grid_across(a6),d2    ;hit end of grid?
  641.         bls.s    SPAC_L2            ;do more if not
  642.  
  643.         clr.b    (a1)        ;else pop in final EOS
  644.         rts            ;and done.
  645.  
  646.  
  647. * ShowPartDown(a6)
  648. * a6 = ptr to main program variables
  649.  
  650. * Perform the same function as ShowPartAcross(), except
  651. * this time do it for a down clue.
  652.  
  653. * d0-d3/a0-a1 corrupt
  654.  
  655. ShowPartDown    tst.w    pick_down(a6)        ;got a down clue?
  656.         beq.s    SPDN_Done        ;exit if not
  657.  
  658.         move.w    pick_Dnh(a6),d0        ;get start square
  659.         move.w    pick_Dnv(a6),d1        ;position
  660.         move.w    d1,d2            ;copy vert pos
  661.         subq.w    #1,d1
  662.         move.w    grid_across(a6),d3
  663.         add.w    d3,d3
  664.         mulu    d3,d1
  665.         add.l    grid_array(a6),d1
  666.         move.l    d1,a0
  667.         add.w    d0,a0
  668.         add.w    d0,a0
  669.         subq.l    #2,a0        ;point to 1st square
  670.  
  671.         lea    GetSolution(pc),a1
  672.         move.l    gg_SpecialInfo(a1),a1
  673.         clr.w    si_BufferPos(a1)
  674.         move.l    si_Buffer(a1),a1
  675.  
  676.         btst    #6,applic_flag1(a6)    ;which crossword type?
  677.         bne.s    SPDN_L2            ;skip if type 2
  678.  
  679. SPDN_L1        move.w    (a0),d0        ;get square data
  680.         add.w    d3,a0        ;point to next down square
  681.         tst.b    d0        ;hit black square?
  682.         beq.s    SPDN_B2        ;exit loop if so
  683.         cmp.b    #" ",d0        ;char a " "?
  684.         bne.s    SPDN_B1        ;skip if not
  685.         move.b    #"-",d0        ;else make a "-"
  686. SPDN_B1        move.b    d0,(a1)+        ;insert char into buffer
  687.         addq.w    #1,d2        ;next vert pos
  688.  
  689.         cmp.w    grid_down(a6),d2    ;hit end of grid?
  690.         bls.s    SPDN_L1            ;back for more if not
  691.  
  692. SPDN_B2        clr.b    (a1)        ;insert EOS
  693.  
  694. SPDN_Done    rts
  695.  
  696. SPDN_L2        move.w    (a0),d0        ;get square data
  697.         add.w    d3,a0        ;point to next square
  698.         cmp.b    #" ",d0        ;hit a " "?
  699.         bne.s    SPDN_B3        ;skip if not
  700.         move.b    #"-",d0        ;else change it into a "-"
  701. SPDN_B3        move.b    d0,(a1)+        ;pop char into buffer
  702.  
  703.         btst    #9,d0        ;hit horizontal bar?
  704.         bne.s    SPDN_B2        ;exit if so
  705.  
  706.         addq.w    #1,d2        ;next vert pos
  707.         cmp.w    grid_down(a6),d2    ;hit end of grid?
  708.         bls.s    SPDN_L2        ;do more if not
  709.  
  710.         clr.b    (a1)        ;else pop in final EOS
  711.         rts            ;and done.
  712.  
  713.  
  714. * TransferSoln(a0,a1)
  715. * a0 = ptr to string gadget structure
  716. * a1 = ptr to transfer buffer
  717.  
  718. * Transfers solution from string gadget in Solve Requester
  719. * to the appropriate buffer. Also converts to upper case and
  720. * strips out spaces and other non-alphabetic/non-digit charac-
  721. * ters.
  722.  
  723. * This routine allows solutions typed into the string gadget to
  724. * contain embedded spaces, e.g.:
  725.  
  726. *        three stooges
  727.  
  728. * or hyphens, e.g.:
  729.  
  730. *        jean-paul sartre
  731.  
  732. * which will be stripped prior to entry into the grid.
  733. * The routine allows digits 0-9 to be accepted so that the
  734. * program can be used to solve number jigs or cross-number
  735. * puzzles.
  736.  
  737. * a0/a1 corrupt
  738.  
  739.  
  740. TransferSoln    move.l    gg_SpecialInfo(a0),a0
  741.         move.l    si_Buffer(a0),a0        ;point to text
  742.  
  743. TSN_L1        move.b    (a0)+,d0        ;get char
  744.         beq.s    TSN_B2        ;EOS hit-finish!
  745.  
  746.         cmp.b    #"0",d0        ;Digit?
  747.         bcs.s    TSN_L1        ;get next if not
  748.         cmp.b    #"9",d0        ;Digit?
  749.         bls.s    TSN_B1        ;copy it if so
  750.  
  751.         cmp.b    #"A",d0        ;Capital letter?
  752.         bcs.s    TSN_L1        ;get next if not
  753.         cmp.b    #"Z",d0        ;Capital letter?
  754.         bls.s    TSN_B1        ;copy it if so
  755.  
  756.         cmp.b    #"a",d0        ;small letter?
  757.         bcs.s    TSN_L1        ;get next if not
  758.         cmp.b    #"z",d0        ;small letter?
  759.         bhi.s    TSN_L1        ;get next if not
  760.  
  761. ;        cmp.b    #" ",d0        ;space?
  762. ;        beq.s    TSN_L1        ;skip it if so
  763.  
  764. ;        cmp.b    #"a",d0        ;outside lower case range?
  765. ;        bcs.s    TSN_B1        ;skip if so
  766.  
  767. ;        cmp.b    #"z",d0        ;outside lower case range?
  768. ;        bhi.s    TSN_B1        ;skip if so
  769.  
  770.         and.b    #$DF,d0        ;convert to upper case
  771.  
  772. TSN_B1        move.b    d0,(a1)+        ;copy chars across
  773.         bra.s    TSN_L1        ;and back for more
  774.  
  775. TSN_B2        move.b    d0,(a1)        ;write EOS to buffer
  776.         rts            ;done!
  777.  
  778.  
  779.  
  780.  
  781.  
  782. * InsertAcross(a6) -> d0
  783. * a6 = ptr to main program variables
  784.  
  785. * Takes solution for across clue, and tries to insert it into
  786. * the grid. Failure conditions are:
  787.  
  788. *    1) Trial solution string length wrong
  789.  
  790. *    2) Solution clashes with existing solutions
  791. *       already in grid
  792.  
  793. * Return code in D0:
  794.  
  795. * 0    : Successful insertion (or else no text to insert)
  796.  
  797. * 1    : Solution clashes with existing solutions
  798.  
  799. * 2    : Solution has too few chars
  800.  
  801. * 3    : Solution has too many chars
  802.  
  803.  
  804. * d0-d6/a0-a1 corrupt (because SetSquare() corrupts
  805. * d4-d6 in addition to others)
  806.  
  807.  
  808. InsertAcross    btst    #6,applic_flag1(a6)    ;Type 1 crossword?
  809.         bne    IA_B7            ;skip if not
  810.  
  811.  
  812. * Here handle solution insertion for Type 1 crossword.
  813.  
  814.  
  815.         move.l    soln_across(a6),d0    ;ptr to solution text
  816.         beq    IA_Done            ;no ptr-exit
  817.  
  818.         move.l    d0,a0            ;ptr in proper location
  819.         tst.b    (a0)            ;null string?
  820.         beq    IA_B6            ;exit NOW if so
  821.  
  822.         move.w    pick_across(a6),d0    ;got an across clue?
  823.         beq    IA_Done            ;no, so exit without fuss
  824.  
  825.         move.w    pick_Ach(a6),d0        ;get position of 1st
  826.         move.w    pick_Acv(a6),d1        ;square of clue
  827.  
  828.  
  829. IA_L1        move.b    (a0)+,d2            ;get char
  830.         beq.s    IA_B4            ;exit-no more text
  831.  
  832.         cmp.w    grid_across(a6),d0    ;off RHS edge?
  833.         bls.s    IA_B1            ;no, continue
  834.  
  835.         moveq    #3,d0        ;else exit with ERROR
  836.         bra.s    IA_Done        ;if off RHS edge
  837.  
  838. IA_B1        move.w    d1,d3
  839.         subq.w    #1,d3
  840.         mulu    grid_across(a6),d3
  841.         move.l    d3,a1
  842.         add.w    d0,a1
  843.         subq.l    #1,a1
  844.         add.l    a1,a1            ;point to
  845.         add.l    grid_array(a6),a1        ;current square
  846.  
  847.         move.w    (a1),d3        ;get square data
  848.         tst.b    d3        ;black square?
  849.         bne.s    IA_B2        ;no, ok
  850.  
  851.         moveq    #3,d0        ;exit with ERROR
  852.         bra.s    IA_Done        ;if black square hit
  853.  
  854. IA_B2        cmp.b    #" ",d3        ;this square blank?
  855.         beq.s    IA_B3        ;skip if so
  856.         cmp.b    d3,d2        ;chars equal?
  857.         beq.s    IA_B3        ;skip if so
  858.  
  859.         moveq    #1,d0        ;exit with ERROR
  860.         bra.s    IA_Done        ;if solution clashes
  861.  
  862. IA_B3        move.b    d2,d3        ;else insert square char
  863.         move.w    d3,(a1)
  864.  
  865.         movem.l    d0-d2/a0,-(sp)    ;save this lot
  866.  
  867.         move.w    d3,d2
  868.         bsr    SetSquare    ;put char in synthetic rastport
  869.  
  870.         movem.l    (sp)+,d0-d2/a0    ;recover this lot
  871.  
  872.         addq.w    #1,d0            ;next across square
  873.         bra.s    IA_L1
  874.  
  875.         moveq    #3,d0        ;exit with ERROR
  876.         bra.s    IA_Done        ;if run off grid
  877.  
  878. IA_B4        cmp.w    grid_across(a6),d0    ;next square exists?
  879.         bls.s    IA_B5            ;skip if so
  880.  
  881. IA_B6        moveq    #0,d0        ;else return with OK signal
  882.         rts            ;(solution fits)
  883.  
  884. IA_B5        move.w    d1,d3
  885.         subq.w    #1,d3
  886.         mulu    grid_across(a6),d3
  887.         move.l    d3,a1
  888.         add.w    d0,a1
  889.         subq.l    #1,a1
  890.         add.l    a1,a1            ;point to
  891.         add.l    grid_array(a6),a1        ;next square
  892.  
  893.         move.w    (a1),d3        ;get square data
  894.         tst.b    d3        ;next square black?
  895.         beq.s    IA_B6        ;return if black (OK)
  896.  
  897.         moveq    #2,d0        ;else error return
  898. IA_Done        rts            ;(too few chars)
  899.  
  900.  
  901. * Here, handle solution insertion for Type 2 crossword.
  902.  
  903.  
  904. IA_B7        move.l    soln_across(a6),d0    ;ptr to solution text
  905.         beq.s    IA_Done            ;no ptr-exit
  906.  
  907.         move.l    d0,a0            ;ptr in proper location
  908.         tst.b    (a0)            ;null string?
  909.         beq.s    IA_B6            ;exit NOW if so
  910.  
  911.         move.w    pick_across(a6),d0    ;got an across clue?
  912.         beq.s    IA_Done            ;no, so exit without fuss
  913.  
  914.         move.w    pick_Ach(a6),d0        ;get position of 1st
  915.         move.w    pick_Acv(a6),d1        ;square of clue
  916.  
  917.         moveq    #0,d3        ;safe initialisation
  918.  
  919. IA_L2        move.b    (a0)+,d2        ;get char
  920.         beq.s    IA_B11        ;EOS met-done so exit
  921.  
  922.         btst    #8,d3        ;prev square vert barred?
  923.         bne.s    IA_B8        ;exit if so with error
  924.  
  925.         cmp.w    grid_across(a6),d0    ;off RHS edge?
  926.         bls.s    IA_B9            ;continue if so
  927.  
  928. IA_B8        moveq    #3,d0        ;else exit with ERROR
  929.         rts            ;if RHS edge hit
  930.  
  931. IA_B9        move.w    d1,d3
  932.         subq.w    #1,d3
  933.         mulu    grid_across(a6),d3
  934.         move.l    d3,a1
  935.         add.w    d0,a1
  936.         subq.l    #1,a1
  937.         add.l    a1,a1            ;point to
  938.         add.l    grid_array(a6),a1        ;current square
  939.  
  940.         move.w    (a1),d3            ;get square data
  941.         cmp.b    d3,d2            ;chars equal?
  942.         beq.s    IA_B10            ;yes, so insert
  943.         cmp.b    #" ",d3            ;blank space?
  944.         beq.s    IA_B10            ;yes, so insert
  945.  
  946.         moveq    #1,d0        ;else exit with ERROR
  947.         rts            ;if chars clash    
  948.  
  949. IA_B10        move.b    d2,d3        ;insert char into grid
  950.         move.w    d3,(a1)
  951.  
  952.         move.w    d3,d2        ;save new grid data
  953.         movem.l    d0-d2/a0,-(sp)    ;save position data & char
  954.         bsr    SetSquare    ;change grid graphic
  955.         movem.l    (sp)+,d0-d2/a0    ;recover position data & char
  956.  
  957.         move.w    d2,d3
  958.  
  959.         addq.w    #1,d0        ;next across square
  960.         bra.s    IA_L2
  961.  
  962. IA_B11        cmp.w    grid_across(a6),d0    ;off RHS?
  963.         bhi    IA_B6            ;yes, so exit OK
  964.  
  965.         btst    #8,d3        ;last square vert barred?
  966.         bne    IA_B6        ;exit OK if so
  967.  
  968.         moveq    #2,d0        ;else exit with ERROR
  969.         rts            ;if not hit a bar
  970.  
  971.  
  972.  
  973.  
  974. * InsertDown(a6)
  975. * a6 = ptr to main program variables
  976.  
  977. * Performs identical function to InsertAcross() above,
  978. * except for down clues.
  979.  
  980. * d0-d6/a0-a1 corrupt (because SetSquare() corrupts
  981. * d4-d6 in addition to others)
  982.  
  983.  
  984. InsertDown    btst    #6,applic_flag1(a6)    ;Type 1 crossword?
  985.         bne    ID_B7            ;skip if not
  986.  
  987.  
  988. * Here, handle solution insertion for Type 1 crossword.
  989.  
  990.  
  991.         move.l    soln_down(a6),d0    ;ptr to solution text
  992.         beq    ID_Done        ;no ptr-exit
  993.  
  994.         move.l    d0,a0        ;ptr in proper location
  995.         tst.b    (a0)        ;null string?
  996.         beq    ID_B6        ;exit NOW if so
  997.  
  998.         move.w    pick_down(a6),d0        ;got a down clue?
  999.         beq    ID_Done            ;no, so exit without fuss
  1000.  
  1001.         move.w    pick_Dnh(a6),d0        ;get position of 1st
  1002.         move.w    pick_Dnv(a6),d1        ;square of clue
  1003.  
  1004. ID_L1        move.b    (a0)+,d2            ;get char
  1005.         beq.s    ID_B4            ;exit-no more text
  1006.  
  1007.         cmp.w    grid_down(a6),d1        ;off bottom edge?
  1008.         bls.s    ID_B1            ;no, continue
  1009.  
  1010.         moveq    #3,d0        ;else exit with ERROR
  1011.         bra.s    ID_Done        ;if off bottom edge
  1012.  
  1013. ID_B1        move.w    d1,d3
  1014.         subq.w    #1,d3
  1015.         mulu    grid_across(a6),d3
  1016.         move.l    d3,a1
  1017.         add.w    d0,a1
  1018.         subq.l    #1,a1
  1019.         add.l    a1,a1            ;point to
  1020.         add.l    grid_array(a6),a1        ;current square
  1021.  
  1022.         move.w    (a1),d3        ;get square data
  1023.         tst.b    d3        ;black square?
  1024.         bne.s    ID_B2        ;no, ok
  1025.  
  1026.         moveq    #3,d0        ;exit with ERROR
  1027.         bra.s    ID_Done        ;if black square hit
  1028.  
  1029. ID_B2        cmp.b    #" ",d3        ;this square blank?
  1030.         beq.s    ID_B3        ;skip if so
  1031.         cmp.b    d3,d2        ;chars equal?
  1032.         beq.s    ID_B3        ;skip if so
  1033.  
  1034.         moveq    #1,d0        ;exit with ERROR
  1035.         bra.s    ID_Done        ;if solution clashes
  1036.  
  1037. ID_B3        move.b    d2,d3        ;else insert square char
  1038.         move.w    d3,(a1)
  1039.  
  1040.         movem.l    d0-d2/a0,-(sp)    ;save this lot
  1041.  
  1042.         move.w    d3,d2
  1043.         bsr    SetSquare    ;put char in synthetic rastport
  1044.  
  1045.         movem.l    (sp)+,d0-d2/a0    ;recover this lot
  1046.  
  1047.         addq.w    #1,d1        ;next down square
  1048.         bra.s    ID_L1
  1049.  
  1050.         moveq    #3,d0        ;exit with ERROR
  1051.         bra.s    ID_Done        ;if run off grid
  1052.  
  1053. ID_B4        cmp.w    grid_down(a6),d1    ;next square exists?
  1054.         bls.s    ID_B5        ;skip if so
  1055.  
  1056. ID_B6        moveq    #0,d0        ;else return with OK signal
  1057.         rts            ;(solution fits)
  1058.  
  1059. ID_B5        move.w    d1,d3
  1060.         subq.w    #1,d3
  1061.         mulu    grid_across(a6),d3
  1062.         move.l    d3,a1
  1063.         add.w    d0,a1
  1064.         subq.l    #1,a1
  1065.         add.l    a1,a1            ;point to
  1066.         add.l    grid_array(a6),a1        ;next square
  1067.  
  1068.         move.w    (a1),d3        ;get square data
  1069.         tst.b    d3        ;next square black?
  1070.         beq.s    ID_B6        ;return if black (OK)
  1071.  
  1072.         moveq    #2,d0        ;else error return
  1073.  
  1074. ID_Done        rts
  1075.  
  1076.  
  1077. * Here, handle solution insertion for Type 2 crossword.
  1078.  
  1079.  
  1080. ID_B7        move.l    soln_down(a6),d0    ;ptr to solution text
  1081.         beq.s    ID_Done        ;no ptr-exit
  1082.  
  1083.         move.l    d0,a0        ;ptr in proper location
  1084.         tst.b    (a0)        ;null string?
  1085.         beq.s    ID_B6        ;exit NOW if so
  1086.  
  1087.         move.w    pick_down(a6),d0    ;got a down clue?
  1088.         beq.s    ID_B6        ;no, so exit without fuss
  1089.  
  1090.         move.w    pick_Dnh(a6),d0    ;get position of 1st
  1091.         move.w    pick_Dnv(a6),d1    ;square of clue
  1092.  
  1093.         moveq    #0,d3        ;safe initialisation
  1094.  
  1095. ID_L2        move.b    (a0)+,d2        ;get char
  1096.         beq.s    ID_B11        ;EOS met-done so exit
  1097.  
  1098.         btst    #9,d3        ;prev square horiz barred?
  1099.         bne.s    ID_B8        ;exit if so with error
  1100.  
  1101.         cmp.w    grid_down(a6),d1    ;off bottom edge?
  1102.         bls.s    ID_B9        ;continue if so
  1103.  
  1104. ID_B8        moveq    #3,d0        ;else exit with ERROR
  1105.         rts            ;if RHS edge hit
  1106.  
  1107. ID_B9        move.w    d1,d3
  1108.         subq.w    #1,d3
  1109.         mulu    grid_across(a6),d3
  1110.         move.l    d3,a1
  1111.         add.w    d0,a1
  1112.         subq.l    #1,a1
  1113.         add.l    a1,a1            ;point to
  1114.         add.l    grid_array(a6),a1        ;current square
  1115.  
  1116.         move.w    (a1),d3        ;get square data
  1117.         cmp.b    d3,d2        ;chars equal?
  1118.         beq.s    ID_B10        ;yes, so insert
  1119.         cmp.b    #" ",d3        ;blank space?
  1120.         beq.s    ID_B10        ;yes, so insert
  1121.  
  1122.         moveq    #1,d0        ;else exit with ERROR
  1123.         rts            ;if chars clash    
  1124.  
  1125. ID_B10        move.b    d2,d3        ;insert char into grid
  1126.         move.w    d3,(a1)
  1127.  
  1128.         move.w    d3,d2        ;save new grid data
  1129.         movem.l    d0-d2/a0,-(sp)    ;save position data & char
  1130.         bsr    SetSquare    ;change grid graphic
  1131.         movem.l    (sp)+,d0-d2/a0    ;recover position data & char
  1132.  
  1133.         move.w    d2,d3
  1134.  
  1135.         addq.w    #1,d1        ;next down square
  1136.         bra.s    ID_L2
  1137.  
  1138. ID_B11        cmp.w    grid_down(a6),d1    ;off bottom?
  1139.         bhi    ID_B6        ;yes, so exit OK
  1140.  
  1141.         btst    #9,d3        ;last square horiz barred?
  1142.         bne    ID_B6        ;exit OK if so
  1143.  
  1144.         moveq    #2,d0        ;else exit with ERROR
  1145.         rts            ;if not hit a bar
  1146.  
  1147.  
  1148. * This small jump table used to access error routines by the
  1149. * Solve() code without the need for branches.
  1150.  
  1151.  
  1152. ReportList    dc.l    RPT_Solveit    ;Solution inserted OK
  1153.         dc.l    RPT_Clash    ;Solution clashes!
  1154.         dc.l    RPT_TooFew    ;too few chars
  1155.         dc.l    RPT_TooMany    ;too many chars
  1156.  
  1157.  
  1158. * And this is the code that handles the reporting of the various
  1159. * solution entry type errors. 3 entry points, one common exit point
  1160. * resulting in a requester being displayed and then any mistakes
  1161. * being erased. Also handles marking of solved clues.
  1162.  
  1163.  
  1164. Mark_Across    move.l    clue_AcEntry(a6),a0
  1165.         st    cle_Solved(a0)
  1166.         rts
  1167.  
  1168.  
  1169. Mark_Down    move.l    clue_DnEntry(a6),a0
  1170.         st    cle_Solved(a0)
  1171.         rts
  1172.  
  1173.  
  1174. RPT_Solveit    move.l    solvecode(a6),a0
  1175.         jmp    (a0)
  1176.  
  1177.  
  1178. RPT_Clash    lea    IRT_1(pc),a0
  1179.         lea    Clashes(pc),a1
  1180.         moveq    #5,d0
  1181.  
  1182.         move.l    a0,irt_itext(a6)
  1183.         move.l    a1,irt_tlist(a6)
  1184.         move.w    d0,irt_count(a6)
  1185.  
  1186.         bra.s    RPT_Doit
  1187.  
  1188. RPT_TooFew    lea    IRT_1(pc),a0
  1189.         lea    TooFew(pc),a1
  1190.         moveq    #4,d0
  1191.  
  1192.         move.l    a0,irt_itext(a6)
  1193.         move.l    a1,irt_tlist(a6)
  1194.         move.w    d0,irt_count(a6)
  1195.  
  1196.         bra.s    RPT_Doit
  1197.  
  1198. RPT_TooMany    lea    IRT_1(pc),a0
  1199.         lea    TooMany(pc),a1
  1200.         moveq    #4,d0
  1201.  
  1202.         move.l    a0,irt_itext(a6)
  1203.         move.l    a1,irt_tlist(a6)
  1204.         move.w    d0,irt_count(a6)
  1205.  
  1206. RPT_Doit        bsr    LinkInfoText        ;pop up the
  1207.         bsr    ShowInfoReq        ;InfoRequester
  1208.  
  1209.         move.l    erasecode(a6),a0        ;now perform the
  1210.         jmp    (a0)            ;erasing operation!
  1211.  
  1212.         rts
  1213.  
  1214.  
  1215.  
  1216. * Solve(a6)
  1217. * a6 = ptr to main program variables
  1218.  
  1219. * Pop up 'Enter Solution' requester, including clue information
  1220. * etc., and then request a solution.
  1221.  
  1222. * d0-d3/d7/a0-a2 corrupt
  1223.  
  1224.  
  1225. Solve        btst    #1,applic_flag2(a6)    ;HELP on?
  1226.         beq.s    Solve_Z1            ;skip if not
  1227.  
  1228.         lea    Help_ES(pc),a0    ;else pop up the
  1229.         moveq    #4,d0        ;help box
  1230.         bsr    _PopUpQR
  1231.  
  1232.         beq    Solve_B2        ;exit if user cancels
  1233.  
  1234. Solve_Z1        bsr    PickClue        ;see above
  1235.  
  1236.  
  1237. * Now handle mouse events here, until a clue has been picked.
  1238. * Temporarily restrict IDCMP to MOUSEMOVE/MOUSEBUTTONS and the
  1239. * gadget selection IDCMPs only (latter to allow grid to be
  1240. * scrolled to find clue to solve etc!).
  1241. * Then recover the normal IDCMP at the end.
  1242.  
  1243.  
  1244.         move.l    mw_handle(a6),a0
  1245.         move.l    #MOUSEMOVE+MOUSEBUTTONS,d0
  1246.         add.l    #GADGETDOWN+GADGETUP,d0
  1247.  
  1248.         CALLINT    ModifyIDCMP
  1249.  
  1250. Solve_L1        move.l    mw_userport(a6),a0
  1251.         lea    ehb_std(pc),a5
  1252.  
  1253.         bsr    DoEvent        ;completely event driven!
  1254.  
  1255.         btst    #3,applic_flag1(a6)    ;picked a clue?
  1256.         bne.s    Solve_L1            ;loop until done
  1257.  
  1258.         move.l    grid_array(a6),a0
  1259.         add.l    grid_offset(a6),a0    ;point to square data
  1260.         move.w    (a0),d0            ;get square data
  1261.         tst.b    d0            ;check if white square
  1262.         bne.s    Solve_1a            ;and continue if OK
  1263.  
  1264.         lea    BlackIsNoNo(pc),a0
  1265.         lea    IRT_1(pc),a1
  1266.         moveq    #3,d0
  1267.  
  1268.         move.l    a0,irt_tlist(a6)    ;inform user that a
  1269.         move.l    a1,irt_itext(a6)    ;white square MUST
  1270.         move.w    d0,irt_count(a6)    ;be selected!
  1271.  
  1272.         bsr    LinkInfoText
  1273.         bsr    ShowInfoReq
  1274.  
  1275.         bra    Solve_B2        ;and exit cleanly
  1276.  
  1277.  
  1278. * If we get to this point, then we've picked a white square. Now
  1279. * find out which clue(s) it belongs to. Could be an across clue,
  1280. * a down clue, or both.
  1281.  
  1282.  
  1283. Solve_1a        bsr    WhichClue    ;find which clue picked
  1284.  
  1285.  
  1286. * Now tell user which clues have been picked to be solved,
  1287. * and request a solution. If both across and down clue picked
  1288. * pop up QueryRequester to see which one is to be solved.
  1289.  
  1290.  
  1291.         move.w    pick_across(a6),d0    ;got an across clue?
  1292.         beq    Solve_B1            ;no, skip
  1293.  
  1294.         tst.w    pick_down(a6)        ;down clue also?
  1295.         beq.s    Solve_Z2            ;skip if not
  1296.  
  1297.         lea    QRT_1(pc),a0
  1298.         lea    SAC_YN(pc),a1
  1299.         moveq    #3,d0
  1300.  
  1301.         move.l    a0,irt_itext(a6)    ;else pop up a
  1302.         move.l    a1,irt_tlist(a6)    ;QueryReq
  1303.         move.w    d0,irt_count(a6)
  1304.  
  1305.         bsr    DoQueryReq
  1306.  
  1307.         btst    #6,applic_flag2(a6)    ;"YES" gadget hit?
  1308.         beq.s    Solve_B1            ;skip if not
  1309.  
  1310. Solve_Z2        lea    ClearAcross(pc),a0    ;addr of erase routine
  1311.         move.l    a0,erasecode(a6)        ;to use on error
  1312.  
  1313.         lea    Mark_Across(pc),a0    ;addr of marker code
  1314.         move.l    a0,solvecode(a6)        ;if sol'n fits
  1315.  
  1316.         bsr    ShowAcrossClue        ;get clue number & display
  1317.         bsr    ShowQuestion        ;as it says!-see above
  1318.  
  1319. ;        lea    GetSolution(pc),a0    ;clear the text
  1320. ;        move.l    gg_SpecialInfo(a0),a0    ;buffer in the
  1321. ;        clr.w    si_BufferPos(a0)        ;string gadget
  1322. ;        move.l    si_Buffer(a0),a0
  1323. ;        clr.b    (a0)
  1324.  
  1325.         bsr    ShowPartAcross    ;display part solution
  1326.  
  1327.  
  1328. * Now set up rhb_ structure for the requester and the
  1329. * HandleRequest() routine and do it...
  1330.  
  1331.  
  1332.         move.l    ThisReq(a6),a4
  1333.         lea    SolveReq(pc),a0
  1334.         move.l    a0,rhb_Requester(a4)
  1335.         lea    DG_Done(pc),a0
  1336.         move.l    a0,rhb_PreCode(a4)
  1337.         move.l    mw_handle(a6),rhb_Window(a4)
  1338.         move.l    mw_userport(a6),rhb_UserPort(a4)
  1339.         move.l    mw_IDCMP(a6),rhb_IDCMP(a4)
  1340.         lea    ehb_req(pc),a0
  1341.         move.l    a0,rhb_EHB(a4)
  1342.  
  1343.         bsr    HandleRequest        ;handle requester
  1344.  
  1345.         lea    GetSolution(pc),a0    ;copy solution
  1346.         move.l    soln_across(a6),a1    ;from string gadget
  1347.         bsr    TransferSoln
  1348.  
  1349.         bsr    InsertAcross        ;try putting it in
  1350.  
  1351.         lea    ReportList(pc),a0
  1352.  
  1353.         add.l    d0,d0        ;error code * 4 as index
  1354.         add.l    d0,d0        ;into jump table
  1355.  
  1356.         add.l    d0,a0        ;point to jump table
  1357.  
  1358.         move.l    (a0),a0        ;get jump address
  1359.  
  1360.         jsr    (a0)        ;and execute 'error' routine
  1361.  
  1362. Solve_B1        move.w    pick_down(a6),d0        ;got a down clue?
  1363.         beq    Solve_B2            ;no, skip
  1364.  
  1365.         tst.w    pick_across(a6)        ;across clue also?
  1366.         beq.s    Solve_Z3            ;skip if not
  1367.  
  1368.         lea    QRT_1(pc),a0
  1369.         lea    SDC_YN(pc),a1
  1370.         moveq    #3,d0
  1371.  
  1372.         move.l    a0,irt_itext(a6)    ;else pop up a
  1373.         move.l    a1,irt_tlist(a6)    ;QueryReq
  1374.         move.w    d0,irt_count(a6)
  1375.  
  1376.         bsr    DoQueryReq
  1377.  
  1378.         btst    #6,applic_flag2(a6)    ;"YES" gadget hit?
  1379.         beq.s    Solve_B2            ;skip if not
  1380.  
  1381. Solve_Z3        lea    ClearDown(pc),a0    ;addr of erase routine
  1382.         move.l    a0,erasecode(a6)    ;to use in case of error
  1383.  
  1384.         lea    Mark_Down(pc),a0    ;addr of marker code
  1385.         move.l    a0,solvecode(a6)    ;if sol'n fits
  1386.  
  1387.         bsr    ShowDownClue    ;get clue no. & display it
  1388.         bsr    ShowQuestion    ;as it says!-see above
  1389.  
  1390. ;        lea    GetSolution(pc),a0    ;clear the text
  1391. ;        move.l    gg_SpecialInfo(a0),a0    ;buffer in the
  1392. ;        clr.w    si_BufferPos(a0)        ;string gadget
  1393. ;        move.l    si_Buffer(a0),a0
  1394. ;        clr.b    (a0)
  1395.  
  1396.         bsr    ShowPartDown
  1397.  
  1398.  
  1399. * Now set up rhb_ structure for the requester and the
  1400. * HandleRequest() routine and do it...
  1401.  
  1402.  
  1403.         move.l    ThisReq(a6),a4
  1404.         lea    SolveReq(pc),a0
  1405.         move.l    a0,rhb_Requester(a4)
  1406. ;        lea    DG_Done(pc),a0
  1407.         lea    InitSolnGad(pc),a0
  1408.         move.l    a0,rhb_PreCode(a4)
  1409.         move.l    mw_handle(a6),rhb_Window(a4)
  1410.         move.l    mw_userport(a6),rhb_UserPort(a4)
  1411.         move.l    mw_IDCMP(a6),rhb_IDCMP(a4)
  1412.         lea    ehb_req(pc),a0
  1413.         move.l    a0,rhb_EHB(a4)
  1414.  
  1415.         bsr    HandleRequest
  1416.  
  1417.         lea    GetSolution(pc),a0
  1418.         move.l    soln_down(a6),a1
  1419.         bsr    TransferSoln
  1420.  
  1421.         bsr    InsertDown    ;try putting it in
  1422.  
  1423.         lea    ReportList(pc),a0
  1424.  
  1425.         add.l    d0,d0        ;error code * 4 as index
  1426.         add.l    d0,d0        ;into jump table
  1427.  
  1428.         add.l    d0,a0        ;point to jump table
  1429.  
  1430.         move.l    (a0),a0        ;get jump address
  1431.  
  1432.         jsr    (a0)        ;and execute 'error' routine
  1433.  
  1434.  
  1435. * Here, we've finished. Restore normal IDCMP & return to
  1436. * main event handler.
  1437.  
  1438.  
  1439. Solve_B2        move.l    mw_handle(a6),a0
  1440.         move.l    mw_IDCMP(a6),d0
  1441.  
  1442.         CALLINT    ModifyIDCMP
  1443.  
  1444.         move.l    mw_handle(a6),a0
  1445.         CALLINT    ActivateWindow
  1446.  
  1447.         bsr    DisplayGrid        ;and show the results
  1448.  
  1449.         rts
  1450.  
  1451.  
  1452. * InitSolnGad(a4)
  1453. * a4 = ptr to initialised requester handler block
  1454.  
  1455. * Activate the solution requester gadget.
  1456.  
  1457. * a0-a2 corrupt
  1458.  
  1459.  
  1460. InitSolnGad    lea    GetSolution(pc),a0
  1461.         move.l    rhb_Window(a4),a1
  1462.         move.l    rhb_Requester(a4),a2
  1463.  
  1464.         CALLINT    ActivateGadget
  1465.  
  1466.         rts
  1467.  
  1468.  
  1469. * GotSolution(a6)
  1470. * a6 = ptr to main program variables
  1471. * handles text transfer from GetSolution requester
  1472. * once entered, & releases the requester loop.
  1473.  
  1474. * nothing corrupt
  1475.  
  1476.  
  1477. GotSolution    bra    QuitReq
  1478.  
  1479.  
  1480. * Rubout(a6)
  1481. * a6 = ptr to main program variables
  1482. * Perform the "Rubout Solution" function.
  1483.  
  1484.  
  1485. * Assume ALL registers corrupt!
  1486.  
  1487.  
  1488. Rubout        btst    #1,applic_flag2(a6)    ;HELP on?
  1489.         beq.s    Rubout_Z1        ;skip if not
  1490.  
  1491.         lea    Help_RS(pc),a0    ;else pop up a
  1492.         moveq    #4,d0        ;help box
  1493.         bsr    _PopUpQR
  1494.  
  1495.         beq    Rubout_B2    ;skip if user cancels
  1496.  
  1497. Rubout_Z1    bsr    PickClue        ;see above
  1498.  
  1499.  
  1500. * Now handle mouse events here, until a clue has been picked.
  1501. * Temporarily restrict IDCMP to MOUSEMOVE/MOUSEBUTTONS and the
  1502. * gadget selection IDCMPs only (latter to allow grid to be
  1503. * scrolled to find clue to solve etc!).
  1504. * Then recover the normal IDCMP at the end.
  1505.  
  1506.  
  1507.         move.l    mw_handle(a6),a0
  1508.         move.l    #MOUSEMOVE+MOUSEBUTTONS,d0
  1509.         add.l    #GADGETDOWN+GADGETUP,d0
  1510.  
  1511.         CALLINT    ModifyIDCMP
  1512.  
  1513. Rubout_L1    move.l    mw_userport(a6),a0
  1514.         lea    ehb_std(pc),a5
  1515.  
  1516.         bsr    DoEvent        ;completely event driven!
  1517.  
  1518.         btst    #3,applic_flag1(a6)    ;picked a clue?
  1519.         bne.s    Rubout_L1        ;loop until done
  1520.  
  1521.         move.l    grid_array(a6),a0
  1522.         add.l    grid_offset(a6),a0    ;point to square data
  1523.         move.w    (a0),d0            ;get square data
  1524.         tst.b    d0            ;check if white square
  1525.         bne.s    Rubout_1a        ;and continue if OK
  1526.  
  1527.         lea    BlackIsNoNo(pc),a0
  1528.         lea    IRT_1(pc),a1
  1529.         moveq    #3,d0
  1530.  
  1531.         move.l    a0,irt_tlist(a6)    ;inform user that a
  1532.         move.l    a1,irt_itext(a6)    ;white square MUST
  1533.         move.w    d0,irt_count(a6)    ;be selected!
  1534.  
  1535.         bsr    LinkInfoText
  1536.         bsr    ShowInfoReq
  1537.  
  1538.         bra    Rubout_B2    ;exit cleanly
  1539.  
  1540. Rubout_1a    bsr    WhichClue    ;find which clue picked
  1541.  
  1542.         move.w    pick_across(a6),d0    ;across clue?
  1543.         beq.s    Rubout_B1        ;skip if not
  1544.  
  1545.         tst.w    pick_down(a6)    ;down clue also?
  1546.         beq.s    Rubout_Y1    ;skip if not
  1547.  
  1548.         lea    QRT_1(pc),a0
  1549.         lea    RAC_YN(pc),a1
  1550.         moveq    #3,d0
  1551.  
  1552.         move.l    a0,irt_itext(a6)    ;else pop up a
  1553.         move.l    a1,irt_tlist(a6)    ;QueryReq
  1554.         move.w    d0,irt_count(a6)
  1555.  
  1556.         bsr    DoQueryReq
  1557.  
  1558.         btst    #6,applic_flag2(a6)    ;"YES" gadget hit?
  1559.         beq.s    Rubout_B1        ;skip if not
  1560.  
  1561. Rubout_Y1    move.l    pick_offset(a6),a0    ;point to picked
  1562.         add.l    grid_array(a6),a0        ;grid square
  1563.         move.w    (a0),d0            ;get square data
  1564.         cmp.b    #" ",d0            ;blank white square?
  1565.         bne.s    Rubout_Z2        ;continue if not
  1566.  
  1567. ;        move.l    clue_AcEntry(a6),a0    ;is there a
  1568. ;        tst.b    cle_Solved(a0)        ;solution to rub out?
  1569. ;        bne.s    Rubout_Z2        ;skip if there is
  1570.  
  1571.         lea    IRT_1(pc),a0        ;else pop up a
  1572.         lea    NoASolnHere(pc),a1    ;requester to inform
  1573.         moveq    #5,d0            ;user
  1574.  
  1575.         move.l    a0,irt_itext(a6)    ;that there is no
  1576.         move.l    a1,irt_tlist(a6)    ;valid solution here
  1577.         move.w    d0,irt_count(a6)
  1578.  
  1579.         bsr    LinkInfoText
  1580.         bsr    ShowInfoReq
  1581.  
  1582.         bra.s    Rubout_B1    ;and go for down clue
  1583.  
  1584. Rubout_Z2    bsr    ClearAcross    ;here erase across solution
  1585.         bsr    DisplayGrid    ;and show the results
  1586.  
  1587.         move.l    clue_AcEntry(a6),a1    ;and signal that
  1588.         clr.b    cle_Solved(a1)        ;it's now erased
  1589.  
  1590. Rubout_B1    move.w    pick_down(a6),d0    ;down clue exists?
  1591.         beq.s    Rubout_B2    ;skip if not
  1592.  
  1593.         tst.w    pick_across(a6)    ;across clue also?
  1594.         beq.s    Rubout_Y2    ;skip if not
  1595.  
  1596.         lea    QRT_1(pc),a0
  1597.         lea    RDC_YN(pc),a1
  1598.         moveq    #3,d0
  1599.  
  1600.         move.l    a0,irt_itext(a6)    ;else pop up a
  1601.         move.l    a1,irt_tlist(a6)    ;QueryReq
  1602.         move.w    d0,irt_count(a6)
  1603.  
  1604.         bsr    DoQueryReq
  1605.  
  1606.         btst    #6,applic_flag2(a6)    ;"YES" gadget hit?
  1607.         beq.s    Rubout_B2        ;skip if not
  1608.  
  1609. Rubout_Y2    move.l    pick_offset(a6),a0    ;point to picked
  1610.         add.l    grid_array(a6),a0        ;grid square
  1611.         move.w    (a0),d0            ;get square data
  1612.         cmp.b    #" ",d0            ;blank white square?
  1613.         bne.s    Rubout_Z3        ;continue if not
  1614.  
  1615. ;        move.l    clue_DnEntry(a6),a0    ;is there a
  1616. ;        tst.b    cle_Solved(a0)        ;solution to rub out?
  1617. ;        bne.s    Rubout_Z3        ;skip if there is
  1618.  
  1619.         lea    IRT_1(pc),a0        ;else pop up a
  1620.         lea    NoDSolnHere(pc),a1    ;requester to inform
  1621.         moveq    #5,d0            ;user
  1622.  
  1623.         move.l    a0,irt_itext(a6)    ;that there is no
  1624.         move.l    a1,irt_tlist(a6)    ;valid solution here
  1625.         move.w    d0,irt_count(a6)
  1626.  
  1627.         bsr    LinkInfoText
  1628.         bsr    ShowInfoReq
  1629.  
  1630.         bra.s    Rubout_B2    ;and leave
  1631.  
  1632. Rubout_Z3    bsr    ClearDown    ;here erase down solution
  1633.         bsr    DisplayGrid    ;and show the results
  1634.  
  1635.         move.l    clue_DnEntry(a6),a1    ;and signal that
  1636.         clr.b    cle_Solved(a1)        ;it's erased
  1637.  
  1638. Rubout_B2    move.l    mw_handle(a6),a0    ;reset original IDCMP
  1639.         move.l    mw_IDCMP(a6),d0
  1640.  
  1641.         CALLINT    ModifyIDCMP
  1642.  
  1643.         move.l    mw_handle(a6),a0    ;reactivate the main window
  1644.         CALLINT    ActivateWindow
  1645.  
  1646.         rts
  1647.  
  1648.  
  1649. * Various data structures for the solve requester
  1650.  
  1651.  
  1652. SolveReq:
  1653.     dc.l    NULL
  1654.     dc.w    25,12
  1655.     dc.w    270,220
  1656.     dc.w    0,0
  1657.     dc.l    GetSolution
  1658.     dc.l    NULL
  1659.     dc.l    NULL        ;SolveT1
  1660.     dc.w    NULL
  1661.     dc.b    1,0
  1662.     dc.l    NULL
  1663.     dcb.b    32,0
  1664.     dc.l    NULL
  1665.     dc.l    NULL
  1666.     dcb.b    36,0
  1667.  
  1668. GetSolution:
  1669.     dc.l    SolvePanel
  1670.     dc.w    88,188
  1671.     dc.w    100,8
  1672.     dc.w    GADGIMAGE
  1673.     dc.w    GADGIMMEDIATE+RELVERIFY+ENDGADGET
  1674.     dc.w    STRGADGET+REQGADGET
  1675.     dc.l    HBoxS1
  1676.     dc.l    NULL
  1677.     dc.l    IText1
  1678.     dc.l    NULL
  1679.     dc.l    GetSolutionSInfo
  1680.     dc.w    NULL
  1681.     dc.l    DoneIG
  1682.     dc.l    GotSolution
  1683.  
  1684. GetSolutionSInfo:
  1685.     dc.l    GetSolutionSIBuff
  1686.     dc.l    NULL
  1687.     dc.w    0
  1688.     dc.w    256
  1689.     dc.w    0
  1690.     dc.w    0,0,0,0,0
  1691.     dc.l    0
  1692.     dc.l    0
  1693.     dc.l    NULL
  1694.  
  1695. GetSolutionSIBuff:
  1696.     dcb.b    256,0
  1697.     cnop    0,2
  1698.  
  1699. HBoxS1:
  1700.     dc.w    -5,-6
  1701.     dc.w    110,20
  1702.     dc.w    4
  1703.     dc.l    HBox2Data
  1704.     dc.b    $000F,$0000
  1705.     dc.l    NULL
  1706.  
  1707.  
  1708. IText1:
  1709.     dc.b    9,0,RP_JAM1,0
  1710.     dc.w    -29,-20
  1711.     dc.l    NULL
  1712.     dc.l    ITextText1
  1713.     dc.l    IText2
  1714. ITextText1:
  1715.     dc.b    'Enter Solution Below:',0
  1716.     cnop    0,2
  1717. IText2:
  1718.     dc.b    1,0,RP_JAM1,0
  1719.     dc.w    -30,-21
  1720.     dc.l    NULL
  1721.     dc.l    ITextText2
  1722.     dc.l    NULL
  1723. ITextText2:
  1724.     dc.b    'Enter Solution Below:',0
  1725.     cnop    0,2
  1726.  
  1727. SolvePanel:
  1728.     dc.l    NULL
  1729.     dc.w    0,0
  1730.     dc.w    1,1
  1731.     dc.w    GADGHBOX+GADGHIMAGE+GADGIMAGE
  1732.     dc.w    NULL
  1733.     dc.w    BOOLGADGET+REQGADGET
  1734.     dc.l    PanelImage
  1735.     dc.l    NULL
  1736.     dc.l    SolveT1
  1737.     dc.l    NULL
  1738.     dc.l    NULL
  1739.     dc.w    NULL
  1740.     dc.l    NULL
  1741.     dc.l    NULL    ;extra entry!
  1742.  
  1743. SolveT1:
  1744.     dc.b    9,0,RP_JAM1,0
  1745.     dc.w    77,9
  1746.     dc.l    NULL
  1747.     dc.l    STT_1
  1748.     dc.l    SolveT2
  1749.  
  1750. STT_1:
  1751.     dc.b    'Enter Solution',0
  1752.     cnop    0,2
  1753.  
  1754. SolveT2:
  1755.     dc.b    1,0,RP_JAM1,0
  1756.     dc.w    76,8
  1757.     dc.l    NULL
  1758.     dc.l    STT_1
  1759.     dc.l    SolveT3
  1760.  
  1761. SolveT3:
  1762.     dc.b    4,0,RP_JAM1,0
  1763.     dc.w    62,33
  1764.     dc.l    NULL
  1765.     dc.l    ITT_Alt1
  1766.     dc.l    SolveT4
  1767.  
  1768. SolveT4:
  1769.     dc.b    5,0,RP_JAM1,0
  1770.     dc.w    61,32
  1771.     dc.l    NULL
  1772.     dc.l    ITT_Alt1
  1773.     dc.l    SolveT5
  1774.  
  1775. SolveT5:
  1776.     dc.b    9,0,RP_JAM1,0
  1777.     dc.w    11,49
  1778.     dc.l    NULL
  1779.     dc.l    NULL        ;STT_3
  1780.     dc.l    SolveT6
  1781.  
  1782. SolveT6:
  1783.     dc.b    1,0,RP_JAM1,0
  1784.     dc.w    10,48
  1785.     dc.l    NULL
  1786.     dc.l    NULL        ;STT_3
  1787.     dc.l    SolveT7
  1788.  
  1789. SolveT7:
  1790.     dc.b    9,0,RP_JAM1,0
  1791.     dc.w    11,63
  1792.     dc.l    NULL
  1793.     dc.l    NULL        ;STT_4
  1794.     dc.l    SolveT8
  1795.  
  1796. SolveT8:
  1797.     dc.b    1,0,RP_JAM1,0
  1798.     dc.w    10,62
  1799.     dc.l    NULL
  1800.     dc.l    NULL        ;STT_4
  1801.     dc.l    SolveT9
  1802.  
  1803. SolveT9:
  1804.     dc.b    9,0,RP_JAM1,0
  1805.     dc.w    11,77
  1806.     dc.l    NULL
  1807.     dc.l    NULL        ;STT_5
  1808.     dc.l    SolveT10
  1809.  
  1810. SolveT10:
  1811.     dc.b    1,0,RP_JAM1,0
  1812.     dc.w    10,76
  1813.     dc.l    NULL
  1814.     dc.l    NULL        ;STT_5
  1815.     dc.l    SolveT11
  1816.  
  1817. SolveT11:
  1818.     dc.b    9,0,RP_JAM1,0
  1819.     dc.w    11,91
  1820.     dc.l    NULL
  1821.     dc.l    NULL        ;STT_6
  1822.     dc.l    SolveT12
  1823.  
  1824. SolveT12:
  1825.     dc.b    1,0,RP_JAM1,0
  1826.     dc.w    10,90
  1827.     dc.l    NULL
  1828.     dc.l    NULL        ;STT_6
  1829.     dc.l    SolveT13
  1830.  
  1831. SolveT13:
  1832.     dc.b    9,0,RP_JAM1,0
  1833.     dc.w    11,105
  1834.     dc.l    NULL
  1835.     dc.l    NULL        ;STT_7
  1836.     dc.l    SolveT14
  1837.  
  1838. SolveT14:
  1839.     dc.b    1,0,RP_JAM1,0
  1840.     dc.w    10,104
  1841.     dc.l    NULL
  1842.     dc.l    NULL        ;STT_7
  1843.     dc.l    SolveT15
  1844.  
  1845. SolveT15:
  1846.     dc.b    9,0,RP_JAM1,0
  1847.     dc.w    11,119
  1848.     dc.l    NULL
  1849.     dc.l    NULL        ;STT_8
  1850.     dc.l    SolveT16
  1851.  
  1852. SolveT16:
  1853.     dc.b    1,0,RP_JAM1,0
  1854.     dc.w    10,118
  1855.     dc.l    NULL
  1856.     dc.l    NULL        ;STT_8
  1857.     dc.l    SolveT17
  1858.  
  1859. SolveT17:
  1860.     dc.b    9,0,RP_JAM1,0
  1861.     dc.w    11,133
  1862.     dc.l    NULL
  1863.     dc.l    NULL        ;STT_9
  1864.     dc.l    SolveT18
  1865.  
  1866. SolveT18:
  1867.     dc.b    1,0,RP_JAM1,0
  1868.     dc.w    10,132
  1869.     dc.l    NULL
  1870.     dc.l    NULL        ;STT_9
  1871.     dc.l    NULL
  1872.  
  1873.  
  1874. SolveBuf        ds.b    256
  1875.  
  1876. AcrossBuf    ds.b    256
  1877.  
  1878. DownBuf        ds.b    256
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.